/**
 * 
 * Copyright (C) 2015 by Elcom Software Company
 *
 * @id: DBModule.java, Feb 5, 2015
 *
 */
package com.nip.commons.dbcp;

import java.sql.Connection;

import com.nip.commons.dbcp.basic.DBLogicAbs;
import com.nip.commons.dbcp.interf.IDBCmd;
import com.nip.commons.dbcp.interf.IDBPool;

/**
 * @author ThangNM<thangnm@elcom.com.vn>
 *
 * @version v
 */
public class DBModule extends DBLogicAbs {

    /**
     * @param pool
     */
    public DBModule(IDBPool pool) {
        super(pool);
        // TODO Auto-generated constructor stub
    }

    /* (non-Javadoc)
     * @see com.nip.commons.dbcp.interf.IDBLogic#execute(com.nip.commons.dbcp.interf.IDBCmd)
     */
    @Override
    public void execute(IDBCmd cmd) throws Exception {
        Connection conn = null;
        try{
            conn = pool.getConnection();
            cmd.execute(conn);
        }finally
        {
            close(conn);
        }
        
    }

}
